use "jjps_2021_replication.dta", clear

global cv "rgdpl_r gdp_g tcgdp_r openc  natural  lnfdi"
global spc "year i.year if sample , fe vce(cluster ccode)"
global sps "if sample , fe vce(cluster ccode)"
global sps1 "label compress se  star(* 0.10 ** 0.05 *** 0.01)  scalars(r2_w sigma_u sigma_e rho N_g ) obslast nogaps replace "
global sps2 "order(ca_facpay_r igo     igo_pri_r exconst tcgdp_r rgdpl_r gdp_g  openc lnfdi natural  newgov_dpi yrsoffc_dpi kg ka_open wb imf wto cim) drop(*.year year _cons)"
global sps3 "order(ca_facpay_r igo_all_1 igo_ne_1 igoa_pri_r igone_pri_r exconst tcgdp_r rgdpl_r gdp_g  openc lnfdi natural  newgov_dpi yrsoffc_dpi kg wb imf ) drop(*.year year _cons)"
global sps4 "order(ca_facpay_r igo    igo_pri_r exconst tcgdp_r rgdpl_r gdp_g  openc lnfdi natural  newgov_dpi yrsoffc_dpi kg  wb imf lawodr_icrg property_icrg) drop(*.year year _cons)"
xtset ccode year	

*Table 5
xtreg f.cim  ca_facpay_r igo exconst $cv cim $sps
xtreg f.cim  ca_facpay_r igo exconst igo_pri_r  $cv cim $spc
xtreg f.cim  ca_facpay_r igo exconst igo_pri_r  $cv newgov_dpi cim $spc
xtreg f.cim  ca_facpay_r igo exconst igo_pri_r  $cv yrsoffc_dpi cim $spc
xtreg f.cim  ca_facpay_r igo exconst igo_pri_r  $cv kg cim $spc
xtreg f.cim  ca_facpay_r igo exconst igo_pri_r  $cv ka_open cim $spc
xtreg f.cim  ca_facpay_r igo exconst igo_pri_r  $cv wb cim $spc		
xtreg f.cim  ca_facpay_r igo exconst igo_pri_r  $cv imf cim $spc		
xtreg f.cim  ca_facpay_r igo exconst igo_pri_r  $cv wto cim $spc		

*Table 6	
xtreg f.cim  ca_facpay_r igo_all exconst $cv cim $spc
xtreg f.cim  ca_facpay_r igo_all exconst igoa_pri_r $cv cim $spc
xtreg f.cim  ca_facpay_r igo_all exconst igoa_pri_r $cv newgov_dpi yrsoffc_dpi kg cim $spc
xtreg f.cim  ca_facpay_r igo_all exconst igoa_pri_r $cv wb imf cim $spc
xtreg f.cim  ca_facpay_r igo_low exconst $cv cim $spc
xtreg f.cim  ca_facpay_r igo_low exconst igone_pri_r  $cv cim $spc
xtreg f.cim  ca_facpay_r igo_low exconst igone_pri_r $cv newgov_dpi  yrsoffc_dpi kg cim $spc
xtreg f.cim  ca_facpay_r igo_low exconst igone_pri_r $cv wb imf cim $spc

*Table 7
xtreg f.lawodr_icrg  ca_facpay_r igo  exconst   $cv lawodr_icrg $spc
xtreg f.lawodr_icrg  ca_facpay_r igo  exconst   igo_pri_r  $cv  lawodr_icrg $spc
xtreg f.lawodr_icrg  ca_facpay_r igo  exconst   igo_pri_r  $cv  newgov_dpi  yrsoffc_dpi kg     lawodr_icrg $spc
xtreg f.lawodr_icrg  ca_facpay_r igo  exconst   igo_pri_r  $cv wb  imf lawodr_icrg $spc
xtreg f.property_icrg  ca_facpay_r igo  exconst   $cv property_icrg $spc
xtreg f.property_icrg  ca_facpay_r igo  exconst igo_pri_r $cv property_icrg $spc
xtreg f.property_icrg  ca_facpay_r igo  exconst igo_pri_r $cv newgov_dpi  yrsoffc_dpi kg property_icrg $spc
xtreg f.property_icrg  ca_facpay_r igo  exconst igo_pri_r $cv wb imf property_icrg $spc
 
*Figure 2
sort igo
twoway  (hist igo if sample, color(gs14) yaxis(2)) ///
	(line yline    igo , clpattern(solid) clwidth(medium) lcolor(gs8)) ///
	(line yline    igo if igo>23, clpattern(solid) clwidth(thick) lcolor(gs0)) /// 
	(line conbx_cc igo , clpattern(solid) clwidth(medium) clcolor(black) yaxis() xaxis() ylabel() ytitle("{&Delta}CIM / {&Delta}EXPOSR", size(3)) xtitle("IGO", size(3)) leg(off)) /// 
	(line upperx_cc igo , clpattern(dash) clwidth(medium) clcolor(gs8)) ///
	(line lowerx_cc igo , clpattern(dash) clwidth(medium) clcolor(gs8)) 			   							   

*Figure 3
sort igo
twoway  (hist igo if sample, color(gs14) yaxis(2)) ///
		(line yline    igo , clpattern(solid) clwidth(medium) lcolor(gs8)) ///
		(line yline    igo if igo>29, clpattern(solid) clwidth(thick) lcolor(gs0)) /// 
   		(line conbx_cc1 igo , clpattern(solid) clwidth(medium) clcolor(black) yaxis() xaxis() ylabel()ytitle("{&Delta}Property Rights / {&Delta}EXPOSR", size(3)) xtitle("IGO", size(3)) leg(off)) /// 
   		(line upperx_cc1 igo , clpattern(dash) clwidth(medium) clcolor(gs8)) ///
		(line lowerx_cc1 igo , clpattern(dash) clwidth(medium) clcolor(gs8)) 


  